<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>上传底单</title>
    <jsp:include page="../../head.jsp"/>
</head>
<script type="text/javascript">
    var uploadId = "${declaration.uploadDiDan.id}";
    var declarationId = "${declaration.id}";
    $(document)
            .ready(
                    function () {
                        $("#attachmentFrame").attr(
                                "src",
                                "attach-main?id="
                                + (uploadId == '' ? 'null' : uploadId));
                    });

    function uploadSuccessBizCallBack(id) {
// 		$("input[name='declarationOffer.upload_id.id']").val(id)
    }

    function doClose() {
        jw.close();
    }

    function doSaveUpload() {
        var ids = $($($("#attachmentFrame").contents().get(0)).find("#dataGrid")).getDataIDs();
        var upLoadId = ids[0];
        $.ajax({
                   url: "declaration-doBindingUpLoadId?upLoadId=" + upLoadId + "&declarationId="
                        + declarationId,
                   async: false,
                   success: function (data) {
                       if ($.parseJSON(data.msg).state == 1) {
                           jw.alert($.parseJSON(data.msg).msg);
                       } else {
                           jw.alert($.parseJSON(data.msg).msg);
                       }
                   }
               });
    }
</script>
<body>
<fieldset
        class="replace-ui-jqgrid ui-widget ui-widget-content ui-corner-all mf_con">
    <iframe id="attachmentFrame" style="width: 100%;" scrolling="no"
            frameborder="0"
            onload="this.height=(this.contentDocument.body.scrollHeight+30)"></iframe>
</fieldset>
<div align="center">
    <input id="saveUpload" type="button"
           class="ui-button ui-widget ui-state-default ui-corner-all ui-state-hover"
           role="button" style="margin: 3px;" value="保存" onclick="doSaveUpload();"/>
    <input id="close" type="button"
           class="ui-button ui-widget ui-state-default ui-corner-all ui-state-hover" role="button"
           style="margin: 3px;"
           value="关闭" onclick="doClose();"/>
</div>

</body>
</html>
